import _fetch from './request.js'
// 获取文章详细
function getArticeData (id) {
  return _fetch({
    url: '/app/v1_0/articles/' + id
  })
}
// 获取评论
function getComments (params) {
  return _fetch({
    url: '/app/v1_0/comments',
    params: params
  })
}
// 关注
function focusOn (target) {
  return _fetch({
    needToken: true,
    method: 'post',
    url: '/app/v1_0/user/followings',
    data: { target: target }
  })
}
// 取消关注用户
function followings (target) {
  return _fetch({
    needToken: true,
    url: '/app/v1_0/user/followings/' + target,
    method: 'DELETE'
  })
}
// 文章点赞
function likings (target) {
  return _fetch({
    url: '/app/v1_0/article/likings',
    needToken: true,
    method: 'post',
    data: {
      target: target
    }
  })
}
// 取消文章点赞
function dislikesDel (target) {
  return _fetch({
    url: '/app/v1_0/article/likings/' + target,
    method: 'DELETE',
    needToken: true
  })
}

// 不喜欢文章
function dislikes (target) {
  return _fetch({
    method: 'post',
    url: '/app/v1_0/article/dislikes',
    needToken: true,
    data: {
      target: target
    }
  })
}
// 取消不喜欢文章
function cancelDislikes (target) {
  return _fetch({
    url: '/app/v1_0/article/dislikes/' + target,
    method: 'DELETE',
    needToken: true
  })
}
//
function comments1 (target) {
  return _fetch({
    url: '/app/v1_0/comments',
    method: 'post',
    needToken: true,
    data: target
  })
}
function comments (target, content) {
  return _fetch({
    url: '/app/v1_0/comments',
    method: 'post',
    needToken: true,
    data: { target: target, content: content }
  })
}
// 评论点赞
function commentLikings (target) {
  return _fetch({
    needToken: true,
    url: '/app/v1_0/comment/likings',
    method: 'post',
    data: {
      target: target
    }
  })
}
export {
  getArticeData,
  getComments,
  followings,
  likings,
  dislikesDel,
  dislikes,
  focusOn,
  cancelDislikes,
  comments,
  commentLikings,
  comments1
}
